package com.room.service;

import com.room.mapper.BedroomMapper;
import com.room.pojo.Bedroom;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * @创建人 lin
 * @创建时间 2019/10/7
 * @描述
 */
@Service
public class BedroomService {
    @Autowired
    BedroomMapper bedroomMapper;

    public List<Bedroom> find(Map map){
        return bedroomMapper.find(map);
    }

    public int update(Bedroom bedroom){
        return bedroomMapper.update(bedroom);
    }

    public Bedroom getBedRoomById(String bedRoomId){
        return bedroomMapper.selectByPrimaryKey(bedRoomId);
    }

   public List<Bedroom> getBedroomByApartId(String apartmentId){
        return bedroomMapper.getBedroomByApartId(apartmentId);
   }

   //根据房间id获取房间
   public Bedroom getBedroomByRoomId(String roomId){
        return bedroomMapper.getBedroomByRoomId(roomId);
   }

   public String getMaxId(){
        return bedroomMapper.getMaxId();
   }

   public int addBedroom(Bedroom bedroom){
        return bedroomMapper.insert(bedroom);
   }
}
